package cn.agiledata.bank.transaction.logic;

import java.math.BigDecimal;

/**
 * 交易对方金额
 * 
 * @author maxianbo
 * 
 */
public class PeerAccountAmount {
    /**
     * 订单编号
     */
    private String orderId;

    /**
     * 交易对方账户id
     */
    private long id;

    /**
     * 金额
     */
    private BigDecimal amount;

    /**
     * 手续费
     */
    private BigDecimal fee;

    public PeerAccountAmount(long id) {
        this.id = id;
        this.amount = new BigDecimal(0.00d);
        this.fee = new BigDecimal(0.00d);
    }

    /**
     * 
     * @return 订单编号
     */
    public final String getOrderId() {
        return this.orderId;
    }

    /**
     * 
     * @param orderId
     *            订单编号
     */
    public final void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    /**
     * 
     * @return 金额
     */
    public final BigDecimal getAmount() {
        return this.amount;
    }

    /**
     * 
     * @return 手续费
     */
    public final BigDecimal getFee() {
        return this.fee;
    }

    /**
     * 
     * @return 交易对方账户id
     */
    public final long getId() {
        return this.id;
    }

    /**
     * 
     * @param amount
     *            金额
     */
    public final void setAmount(BigDecimal amount) {
        if (amount == null) {
            this.amount = new BigDecimal(0.00d);
        } else {
            this.amount = amount;
        }
    }

    /**
     * 
     * @param fee
     *            手续费
     */
    public final void setFee(BigDecimal fee) {
        if (fee == null) {
            this.fee = new BigDecimal(0.00d);
        } else {
            this.fee = fee;
        }
    }

    public boolean equals(Object o) {
        if (o == null || !(o instanceof PeerAccountAmount))
            return false;
        PeerAccountAmount p = (PeerAccountAmount) o;
        return this.id == p.id && this.amount.equals(p.amount)
                && this.fee.equals(p.fee);
    }
}
